How can I re-define type conversion from pointer A to point B?
<p>I am trying to be able to swap implementation for A. </p>

<p>We have old code use interface like:</p>

<pre><code>class A;
class B 
{
A* CreateA();
};
</code></pre>

<p>We want to have</p>

<pre><code>class AImpl;

template&lt;typename Impl = AImpl&gt;
class A: public Impl
{
public:
  A(const Impl&amp; a) : Impl(a) {}
};

template&lt;typename Impl = BImpl&gt;
class B : public Impl
{
A* CreateA();
};
</code></pre>

<p>where BImpl only have</p>

<pre><code>AImpl* BImpl::CreateA();
</code></pre>

<p>I am sure we can add:</p>

<pre><code>A* B::CreateA() { return (A*)BImpl::CreateA();}
</code></pre>

<p>but what if there are a lot of different version of CreateA and I am lazy? Is there a way we can define a type converter in AImpl that can implicitly convert AImpl* to A*? so that code like following won't break:</p>

<pre><code>A* pA = BImpl::CreateA();
</code></pre>