title: defining operator + for double and string data types in cpp
body: <p>I am trying to define operator + for string and double using the following function</p>
  <pre><code>string operator + (const double&amp; b,const string a){
      return to_string(b)+a;
  }
  </code></pre>
  <p>When I am doing the following operation, it works well</p>
  <pre><code>double c = 100.256;
  string d = &quot;if only&quot;;
  cout&lt;&lt;c+d&lt;&lt;&quot;\n&quot;;
  </code></pre>
  <p>but when i pass const char instead of string , it throws compilation error(invalid operands of types ‘double’ and ‘const char [4]’ to binary ‘operator+’)</p>
  <pre><code>double c = 100.256;
  string test = c+&quot;sff&quot;;
  </code></pre>
  <p>Why is implicit conversion of const char[] &quot;sff&quot; to string not happening?</p>