title: operator= and functions that are not inherited in C++?
body: <p>Until a test I've just made, I believed that only Constructors were not inherited in C++. But apparently, the assignment <code>operator=</code> is not too... </p>
  
  <ol>
  <li>What is the reason of that ?  </li>
  <li>Is there any workaround to inherit the assignment operator ?  </li>
  <li>Is it also the case for <code>operator+=</code>, <code>operator-=</code>, ... ? </li>
  <li>Are all other functions (apart from constructors/operator=) inherited ?</li>
  </ol>
  
  <p>In fact, I encountered this problem as I was doing some CRTP :</p>
  
  <pre><code>template&lt;class Crtp&gt; class Base
  {
      inline Crtp&amp; operator=(const Base&lt;Crtp&gt;&amp; rhs) {/*SOMETHING*/; return static_cast&lt;Crtp&amp;&gt;(*this);}
  };
  
  class Derived1 : public Base&lt;Derived1&gt;
  {
  };
  
  class Derived2 : public Base&lt;Derived2&gt;
  {
  };
  </code></pre>
  
  <p>Is there any solution to get that working ?</p>
  
  <p>EDIT : OK, I have isolated the problem. Why the following isn't working ? How to solve the problem ?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;type_traits&gt;
  
  // Base class
  template&lt;template&lt;typename, unsigned int&gt; class CRTP, typename T, unsigned int N&gt; class Base
  {
      // Cast to base
      public:
          inline Base&lt;CRTP, T, N&gt;&amp; operator()()
          {
              return *this;
          }
  
      // Operator =
      public:
          template&lt;typename T0, class = typename std::enable_if&lt;std::is_convertible&lt;T0, T&gt;::value&gt;::type&gt;
          inline CRTP&lt;T, N&gt;&amp; operator=(const T0&amp; rhs)
          {
              for (unsigned int i = 0; i &lt; N; ++i) {
                  _data[i] = rhs;
              }
              return static_cast&lt;CRTP&lt;T, N&gt;&amp;&gt;(*this);
          }
  
      // Data members
      protected:
          T _data[N];
  };
  
  // Derived class
  template&lt;typename T, unsigned int N&gt; class Derived : public Base&lt;Derived, T, N&gt;
  {
  };
  
  // Main
  int main()
  {
      Derived&lt;double, 3&gt; x;
      x() = 3; // &lt;- This is OK
      x = 3;   // &lt;- error: no match for 'operator=' in ' x=3 '
      return 0;
  }
  </code></pre>