title: Using copy assignment in derived class
body: <p>The cppreference <a href="https://en.cppreference.com/w/cpp/language/copy_assignment" rel="nofollow noreferrer">says</a>:</p>
  <blockquote>
  <p>Because the copy assignment operator is always declared for any class, the base class assignment operator is always hidden. If a using-declaration is used to bring in the assignment operator from the base class, and its argument type could be the same as the argument type of the implicit assignment operator of the derived class, the using-declaration is also hidden by the implicit declaration.</p>
  </blockquote>
  <p>From my understanding, the following code should not compile. Because</p>
  <ol>
  <li>B::operator=(const B&amp;) is implicitly declared.</li>
  <li>both A::operator=(const A&amp;) and using-declaration are hidden.</li>
  </ol>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class A { 
   public:
      A&amp; operator=(const A&amp; A) {
          cout &lt;&lt; &quot;A::opreator=&quot; &lt;&lt; endl;
      }   
  };
  
  class B : A { 
   public:
      using A::operator=;
  };
  
  int main() {
      A a1; 
      B b1; 
      b1 = a1; 
  }
  </code></pre>
  <p>However, it compiles successfully and prints &quot;A::operator=&quot;, why?</p>