title: Exposing unmanaged types in managed code
body: <p>I have two unmanaged classes, in two different DLLs:</p>
  
  <pre><code>class A
  {
  public:
  void doSomething();
  private:
  int x;
  }
  
  class B
  {
  public:
  void doSomethingToAnA(A*);
  }
  </code></pre>
  
  <p>and I want to wrap them both in managed C++, so naturally:</p>
  
  <pre><code>ref class managedA
  {
  public:
  void doSomething();
  private:
  A* unmanagedA;
  }
  
  ref class managedB
  {
  public:
  void doSomethingToAnA(managedA*);
  private:
  B* unmanagedB;
  }
  </code></pre>
  
  <p>so doSomethingToAnA(managedA*) should probably look like this:</p>
  
  <pre><code>void managedB::doSomethingToAnA(managedA* a)
  {
  unmanagedB-&gt;doSomethingToAnA(a-&gt;unmanagedA);
  }
  </code></pre>
  
  <p>however, unmanagedA is private. I don't want to change its visibility or create a getter for it because then a C# user will also be able to see it (which is very strange), plus, it's wrong design-wise.
  I also can't use private public visibility since the classes are located in different DLLs.</p>
  
  <p>is there a good "textbook" solution for this problem?</p>