Template friend function of a template class
I was struggling with the issue described in this question (declaring a template function as a friend of a template class), and I believe the 2nd answer is what I want to do (forward declare the template function, then name a specialization as a friend). I have a question about whether a slightly different solution is actually correct or just happens to work in Visual C++ 2008. Test code is: #include <iostream> // forward declarations template <typename T> class test; template <typename T> std::ostream& operator<<(std::ostream &out, const test<T> &t); template <typename T> class test { friend