title: Declaring main as friend considered harmful?
body: <h2>Discussion</h2>
  
  <p>I know that <code>main</code> can be a friend of a <code>class</code>:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  class foo {
    friend int main();
    int i = 4;
  };
  
  int main() {
    foo obj;
    std::cout &lt;&lt; obj.i &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p><a href="http://coliru.stacked-crooked.com/a/7e8a021134b403f1"><kbd><strong>LIVE DEMO</strong></kbd></a></p>
  
  <p>However, I feel that although this is perfectably allowable it conceals many dangers.</p>
  
  <h2>Questions</h2>
  
  <ol>
  <li>Are there any valuable uses in making <code>main</code> a friend of a class?</li>
  <li>Are there any reasons that declaring <code>main</code> as friend of a class should be considered harmful? </li>
  </ol>