Mutually-dependent C++ classes, held by std::vector : <p>I was curious if was possible to create two classes, each of which holds a <code>std::vector</code> of the other.  My first guess was that it would not be possible, because <code>std::vector</code> requires a complete type, not just a forward declaration.</p>

<pre><code>#include &lt;vector&gt;

class B;
class A { std::vector&lt;B&gt; b; };
class B { std::vector&lt;A&gt; a; };
</code></pre>

<p>I would think that the declaration of <code>std::vector&lt;B&gt;</code> would cause an immediate failure, because <code>B</code> has an incomplete type at this point.  However, this compiles successfully under both gcc and clang, without any warnings.  Why doesn't this cause an error?</p>
