title: (declared implicitly) cannot be referenced -- it is a deleted function
body: <p>With the following code, I'm facing an issue. </p>
  
  <p>ABC.h</p>
  
  <pre><code>namespace abcd
  {
      class ABC
      {
      public:
          ABC() = delete;
          ABC(const std::string&amp; filename);
          virtual ~ABC();
          ABC(const ABC&amp;) = delete;
          ABC(ABC&amp;&amp;) = default;
      };
  }
  </code></pre>
  
  <p>XYZ.h</p>
  
  <pre><code>using namespace abcd;
  
  class XYZ
  {
  public:
      void func();
  private:
      ABC obj;
      ABC maskfilename(std::string filename);
  };
  </code></pre>
  
  <p>XYZ.cpp</p>
  
  <pre><code>XYZ::func()
  {
      obj = maskfilename("abcd.txt"); //Error
  }
  
  abcd::ABC XYZ::maskfilename(string filename)
  {
      abcd::ABC ret;
      // blah blah...
      return ret;
  }
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
    <p>"abcd::ABC::operator=(const abcd::ABC &amp;)" (declared implicitly) cannot be referenced -- it is a deleted function</p>
  </blockquote>
  
  <p>I understand it is move constructor only class (<code>ABC</code>).</p>
  
  <p>What is the right way to use this? I want to retain the return value from <code>maskfilename()</code> in the <code>XYZ</code> class, so it can be used in other functions of the <code>XYZ</code> class.</p>
  
  <p>How can I resolve this error?</p>