title: string comparison with user build string-like type
body: <p>Normally you can compare strings..</p>
  
  <pre><code>if (var1 == "a string") ...
  </code></pre>
  
  <p>But when I declare my own class with the conversion operator, like this :</p>
  
  <pre><code>class my_type {
     operator std::string() const { ... };
     ....
  }
  </code></pre>
  
  <p>Now this :</p>
  
  <pre><code> std::string var1("a string");
   my_type x("a string");
   if (x == "a string") ....
   if (x == var1) ....
  </code></pre>
  
  <p>does not work.. i.e....</p>
  
  <pre><code>error: no match for ‘operator==’ 
  </code></pre>
  
  <p>Of course this works :</p>
  
  <pre><code> if ((std::string) x == var1) ....
  </code></pre>
  
  <p>But I want it to happen w/o explicitly casting.
  why does not c++ convert my_type to string for comparison..
  How can I force it to do this w/o implementing the "==" operator itself ?
  The same goes for the other comparison operators.</p>
  
  <p>thank you</p>
  
  <p>PS> Btw if I implement operator which convert my_type to numbers(it is OK for my type)...like :</p>
  
  <pre><code> operator double() const { ... };
  </code></pre>
  
  <p>the comparison with numbers work ok, I don't need to implement ==,etc.....</p>