title: 'operator =' is ambiguous for std::string
body: <p>I am trying to write a class with my own cast operators but I am having issues with multiple <code>operator=</code>s</p>
  
  <p>I managed to reproduce the issue with the small code below</p>
  
  <pre><code>#include &lt;string&gt;
  
  class X
  {
  public:
    operator const char*() const {
      return "a";
    }
    operator std::string() {
      return "c";
    }
  };
  
  void func( )
  {
    X x;
    std::string s = "";
    s = x;
  }
  </code></pre>
  
  <p>I understand that <code>std::basic_string</code> has multiple assignment operator and this is why the compiler gets confused.</p>
  
  <p>If I remove either cast operators it works, but I was wondering if there was a way of keeping both operators.</p>
  
  <p>My class will be returning different values depending on the cast.</p>
  
  <p>I could also use <code>static_cast&lt;std::string&gt;(x)</code> to force the cast, but I was wondering if there was a a way of doing it without the static cast?</p>