right way to return new instances from subclass of C++ string
<p>I want to extend the C++ string class, returning subclass references (instead of parent string reference), but this code excerpt...</p>

<pre><code>#include &lt;string&gt;
using namespace std;

class mystring : public string
{
public:
 mystring&amp;  left( int cnt )
 {   return  (mystring&amp;)mystring( substr(0,cnt) );
 }
};
</code></pre>

<p>produces this VS8 compiler error:</p>

<blockquote>
  <p>error C2440: '' :
  cannot convert from
  'std::basic_string&lt;_Elem,_Traits,_Ax>'
  to 'mystring'</p>
</blockquote>

<p>What's the right way to declare mystring::left() so the compiler will stop complaining, hopefully also eliminating the cast?</p>
