title: To Check if a class can be typecast to another
body: <p>If I have a template function</p>
  
  <pre><code>template&lt;class T, class U&gt;
  T foo (U a);
  </code></pre>
  
  <p>How can I check If an object of class <code>U</code> can be type cast into an object <code>T</code></p>
  
  <p>That is If The class <code>U</code> has a member function </p>
  
  <pre><code>operator T(); // Whatever T maybe
  </code></pre>
  
  <p>Or the class <code>T</code> has a constructor</p>
  
  <pre><code>T(U&amp; a); //ie constructs object with the help of the variable of type U
  </code></pre>