title: C++ Templates type casting with derivates
body: <p>I'm trying to cast from one generic to another, say:</p>
  
  <pre><code>myClass&lt;MoreAbstract&gt; anItem = myclass&lt;DerivateFromMoreAbstract&gt; anotherObject;
  </code></pre>
  
  <p>Or do something like</p>
  
  <pre><code>aFunction(anotherObject); // myclass&lt;DerivateFromMoreAbstract&gt; anotherObject 
  </code></pre>
  
  <p>where aFunction signature is</p>
  
  <pre><code>aFunction(myClass&lt;MoreAbstract&gt; item);
  </code></pre>
  
  <p>In fact, myClass is actually a simplified implementation of shared_ptr I found online. I'm wondering if there's any way I can actually switch from one pointer type to another being encapsulated.</p>
  
  <p>Is there any way to do such casting? If so, what would be the correct way to do it?</p>
  
  <p>If it helps anyone, VC++ gives me this error:</p>
  
  <pre><code>Error 1 error C2440: 'type cast' : cannot convert from 'myClass&lt;T&gt;' to 'myClass&lt;T&gt;'
  </code></pre>