title: operator<< for nested class
body: <p>I'm trying to overload the &lt;&lt; operator for the nested class ArticleIterator.</p>
  
  <pre><code>// ...
  class ArticleContainer {
      public:
          class ArticleIterator {
                          // ...
                  friend ostream&amp; operator&lt;&lt;(ostream&amp; out, const ArticleIterator&amp; artit);
          };
          // ...
  };
  </code></pre>
  
  <p>If I define operator&lt;&lt; like I usually do, I get a compiler error.</p>
  
  <pre><code>friend ostream&amp; operator&lt;&lt;(ostream&amp; out, const ArticleContainer::ArticleIterator&amp; artit) {
  </code></pre>
  
  <p>The error is <code>'friend' used outside of class</code>. How do I fix this?</p>