Forward declaration and inheritence
<p>The following code generates an error in the <code>getFoo</code> function because <code>MockFoo</code> hasn't yet been defined as being inherited from <code>IFoo</code>. How can I fix this? The simplest way is to change <code>_foo</code>'s type to IFooPtr. But I'd prefer not to make this change if possible. I can't change the order the classes are defined in.</p>

<pre><code>class MockFoo;
typedef boost::shared_ptr&lt;MockFoo&gt; MockFooPtr;

class MockBar: public IBar
{
    virtual IStructPtr getFoo() const {
        return _foo;
    }
    ...

    MockFooPtr _foo;
};

class MockFoo: public IFoo
{
    ...
};
</code></pre>
