Can not create a friend function for a class that is in a namespace, if the function is not in this namespace.
Example: Command Line: g++ -save-temps main.cpp Error: main.cpp:12: error: std::ostream& operator<<(std::ostream&, S::A&) should have been declared inside :: -- Summary: Impossible to create a friend function for a class in a namespace, outside the namespace. Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sela_lerer at hotmail dot com GCC host triplet: i686-pc-Linux-gcc-c++-4.0.2-8.fc4 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25427