I\'m having some problems defining some operator overloads for template classes. Let\'s take this hypothetical class for example.
template
cl
This helped me with the exact same problem.
Solution:
Forward declare the friend function before the definition of the class itself. For example:
template class MyClass; // pre-declare the template class itself
template std::ostream& operator<< (std::ostream& o, const MyClass & x);
Declare your friend function in your class with "<>" appended to the function name.
friend std::ostream& operator<< <> (std::ostream& o, const Foo& x);