1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
// Bug: g++ doesn't find the conversion from ostream_withassign to ostream. #include <iostream.h> template <class T> struct A { T t; }; template <class T> ostream & operator<< (ostream & os, A<T> & a) { os << a.t; return os; } int main () { A<int> a = { 1 }; cout << a << endl; }