I am trying to overload the <statement for a nested ArticleIterator class.
// ... class ArticleContainer { public: class ArticleIterator { // ... friend ostream& operator<<(ostream& out, const ArticleIterator& artit); }; // ... };
If I define the <<operator as usual, I get a compiler error.
friend ostream& operator<<(ostream& out, const ArticleContainer::ArticleIterator& artit) {
Error 'friend' used outside of class . How to fix it?
source share