title: Forward declaration of nested types/classes in C++
body: <p>I recently got stuck in a situation like this:</p>
  <pre><code>class A
  {
  public:
      typedef struct/class {…} B;
  …
      C::D *someField;
  }
  
  class C
  {
  public:
      typedef struct/class {…} D;
  …
      A::B *someField;
  }
  </code></pre>
  <p>Usually you can declare a class name:</p>
  <pre><code>class A;
  </code></pre>
  <p>But you can't forward declare a nested type, the following causes compilation error.</p>
  <pre><code>class C::D;
  </code></pre>
  <p>Any ideas?</p>