title: How to avoid "'identifier' uses undefined class/struct/union 'name'" error when forward declaration is not enough?
body: <p>According to <a href="http://msdn.microsoft.com/en-us/library/9ekhdcxs(v=vs.80).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/9ekhdcxs(v=vs.80).aspx</a>,</p>
  
  <blockquote>
    <p>C2079 can also occur if you attempt to declare an object on the stack of a type whose forward declaration is only in scope.</p>
  
  <pre><code>class A;
  
  class B {
      A a;   // C2079
  };
  
  class A {};
  </code></pre>
    
    <p>Possible resolution:</p>
  
  <pre><code>class A;
  
  class C {};
  
  class B {
     A * a;
     C c;
  };
  class A {};
  </code></pre>
  </blockquote>
  
  <p>My question is how do I eliminate this error when I have the following situation:</p>
  
  <pre><code>class A;  // Object
  
  class B   // Container
  {
     public:
       typedef int SomeTypedef;
     private:
       A a;   // C2079
  };
  
  class A {
     void Foo(B::SomeTypedef);
  };
  </code></pre>
  
  <p>I can't declare A before declaring B because A needs to use B's typedef, and I can't declare B before A because of this error.</p>
  
  <p>One possible solution is to use a pointer to A instead of a stack variable, but I don't want a pointer (in this case).</p>
  
  <p>Another solution is to not use typedef, or not to put it inside class B. But what if it belongs in B and I want not to pollute my project's namespace, as in B::SomeTypedef is a more appropriate name than SomeTypedef?</p>