g++ 4.5 can't find a friend function
问题 G'day! I have a question around the use of friend in C++. Consider the following piece of code: #include <ostream> struct F { }; struct N { friend std::ostream& operator<< (std::ostream&, const N&); friend std::ostream& operator<< (std::ostream&, const F&); }; void foo(std::ostream &out) { F bar; out << bar; } My understanding always was, that friend is similar to static with the additional property that the friend function has access to the private part of the class. Under that assumption,