title: forward declaration in two headers and two cpp files
body: <p>I have four C++ files, two headers and two cpp. The headers are properly guarded and in the first I use a forward declaration like this:</p>
  
  <pre><code>//A.h
  class B;
  
  class A {
  public:
      A();
      void doSomething(B* b);
  };
  </code></pre>
  
  <p>and some implementation:</p>
  
  <pre><code>void A::doSomething(B* b){
      b-&gt;add();
  }
  </code></pre>
  
  <p>the other header is as follows:</p>
  
  <pre><code>#include "A.h"
  class B {
  public:
      B();
      void add();
  };
  </code></pre>
  
  <p>and</p>
  
  <pre><code>void B::add(){
      cout &lt;&lt; "B is adding" &lt;&lt; endl;
  }
  </code></pre>
  
  <p>I get the "member access into incomplete type B" error and I'm stuck in there. I need to use a  of Bs into A and each B must have a pointer to its "owner", an instance of A. What can I do to solve this situation.</p>
  
  <p>Thanks in advance</p>