#include namespace lab2 { template class WeirdCpp { public: template friend std::ostream& operator<<(std::ostream &of,const WeirdCpp &c); T nada; }; template std::ostream &operator<<(std::ostream &of, const WeirdCpp &c){ of << "apa\n"; //this doesn't work, gives //weirdcpp.h:12: error: no match for ‘operator<<’ in ‘of << "apa\012"’ //this works of << std::string("apa"); return of; } };