title: friend ref class?
body: <p>I have a managed class <code>Parser</code> and an unmanaged class <code>CParser</code>. The former is exposed from a DLL for managed clients (C# world). The core functionality is in the unmanaged class <code>CParser</code>. Since both are in the same DLL, and there is a one-to-one relationship, the managed class can access the unmanaged class.</p>
  
  <p>The problem is that I want <code>Parser</code> to access all members of <code>CParser</code>. I don't want to use <code>public:</code> for all members, nor I am willing to have setters and getters. Thus, I just placed <code>friend</code> keyword:</p>
  
  <pre><code>class CParser
  {
     ...
     friend ref class Parser; // C2144
  };
  
  // public ref class Parser{}; 
  </code></pre>
  
  <p>I get error <code>C2144</code>, probably for obvious reason that unmanaged C++ doesn't understand <code>ref</code> keyword. If I remove <code>ref</code> keyword, the managed compiler (compiling <code>Parser</code>), would complain with error C2872: Ambigious Symbol.</p>
  
  <p>It is also known that <code>internal:</code> is not applicable for unmanged C++. </p>
  
  <p>How to make <code>Parser</code> a friend of <code>CParser</code> ?</p>
  
  <p>EDIT:
  This question was already <a href="http://social.msdn.microsoft.com/forums/en-US/vclanguage/thread/f43ea201-02b9-4ae1-bbfe-7416d778c3d3" rel="nofollow">here</a>, but probably the unmanaged class is compiled under <code>/clr</code>. I cannot/will not compile unmanaged class using managed compiler.</p>