title: How do I make main a friend of my class?
body: <p>I'm thinking this is possible, but the compiler is complaining it cannot access the protected/private members of my class. I've tried moving stuff around and changing signatures, but can't find a combination that works.</p>
  
  <p>I essentially have:</p>
  
  <pre><code>class MyClass
  {
  public:
      friend int main(int argc, char** argv);
  
  private:
      void test()
      {
          cout &lt;&lt; "My friend has accessed my member" &lt;&lt; endl;
      }
  };
  
  int main(int argc, char** argv)
  {
      MyClass mc;
      mc.test();
  }
  </code></pre>