Getting a value of object for user-defined classes for while, if and for statements
<p>I am trying to get a bool value out of user defined object.
For example with float or int I can do something like</p>

<pre><code>float a = 3.5
if (a) doSomething();
</code></pre>

<p>I want my class to look like this:</p>

<pre><code>class Socket {
...
...
};
...
Socket T;

if (!T) cout &lt;&lt; "Error occured";
else {
   doStuff();
}
</code></pre>

<p>Of course I can define a function that returns bool (like bool isValid();) and call it directly, but I would like to know if it is possible.</p>
