title: C++ : error: invalid operands of types ‘String*’ and ‘const char [7]’ to binary ‘operator+’
body: <p>I'm learning cpp and In my last assignment I am rewriting the std::string class.
  so here is an outline of my code:
  string class:</p>
  
  <pre><code>   class String {
      public:
          String(const char* sInput) {
              string = const_cast&lt;char*&gt; (sInput);                
          }
  
          const String operator+(const char* str) {
              //snip
              print();
          }
  
          void print() {
              cout&lt;&lt;string;
          }
  
          int search(char* str) {
  
          }
  
      private:
          char* string;
          int len;
  };
  </code></pre>
  
  <p>Oh and I have to say I tried to declare the method as String* operator+(const char* str) and as const String&amp; operator+(const char* str) with no change.
  And here is how I run it:</p>
  
  <pre><code>int main(int argc, char* argv[]) {
      String* testing = new String("Hello, "); //works
      testing-&gt;print();//works
      /*String* a = */testing+"World!";//Error here.
  return 0;
  }
  </code></pre>
  
  <p>The full error goes like such:</p>
  
  <blockquote>
    <p>foobar.cc:13: error: invalid operands
    of types ‘String*’ and ‘const char
    [7]’ to binary ‘operator+’</p>
  </blockquote>
  
  <p>I looked up on Google and in the book I am learning from with no success.
  any one with suggestions? (I am pretty sure I am doing something foolish you will have to forgive me I am  originally a PHP programmer) can any one point me to what am I missing?</p>