title: why C++ operator overloading requires "having at least one parameter of class type"?
body: <p>The chapter 14.1 of "C++ primer 5th edition" reads, </p>
  
  <blockquote>
    <p>An operator function must either be a member of a class or have at least one parameter of class type. </p>
  </blockquote>
  
  <p>For example, <code>string("hello")+"world"</code> compiles <code>"hello"+"world"</code> doesn't. And when I want to overload the <code>+</code> on two C strings.</p>
  
  <pre><code>std::string operator+ (const char* s1, const char* s2)
  </code></pre>
  
  <p>I get the following error. </p>
  
  <blockquote>
    <p>error: ‘std::string operator+(const char*, const char*)’ must have an argument of class or enumerated type</p>
  </blockquote>
  
  <p>I have two questions.</p>
  
  <ol>
  <li><p><strong>Is this restriction part of the language specification?</strong> If yes, why C++ designers want to do that?</p></li>
  <li><p><code>std::string</code> has constructor like <code>string (const char* s);</code>, which implies that compiler can do implicit class-type conversion from <code>char*</code> to <code>string</code>. When we call <code>"hello"+"world"</code>, <strong>why doesn't the compiler convert the two <code>char*</code> "s to two strings?</strong> After all, there is a overloading "+" on two std::strings. 
  <code>string operator+ (const string&amp; lhs, const string&amp; rhs);</code></p></li>
  </ol>