How to convert a user defined type to primitive type?
<p>Let's say we have a class called <code>Complex</code> which represents a complex number.
I want to convert this object to a <code>double</code> object.</p>

<p>The other way around i can do by implementing a copy ctor in Complex:<br>
<code>Complex(const double &amp;d);</code></p>

<p>However, i can't implement i copy ctor in double which will receive a Complex.</p>

<p>How do i do this? I know there is a way with operator overloading, but i couldn't find how.<br>
Eventually i want the this line will compile:<br>
<code>Complex c;</code><br>
<code>(double)c;</code></p>

<p>Thanks!!</p>
