title: Overloading unary operator &
body: <p>Let's consider a class with overloaded unary operator &amp; (Address-of). Let it be <code>class A</code> </p>
  
  <pre><code>template &lt;class C&gt;
  class A
  {
  public:
      C * operator &amp;()
      {
          return &amp;data;
      }
      //...
  private:
      C data;
  }
  </code></pre>
  
  <p>Now I want to pass to some function a pointer of type <code>A</code> to fill its <code>data</code>. Let us call it <code>f</code></p>
  
  <pre><code>void f(A * auto_containter)
  {
      //...
  }
  </code></pre>
  
  <p>But it is clear why the code bellow wouldn't work (even wouldn't compile). It is because the overloaded operator is called.</p>
  
  <pre><code>A a;
  f(&amp;a);
  </code></pre>
  
  <p>The question is following:</p>
  
  <p>Is there any syntax to pass address of <code>a</code> to <code>f</code>? If no, then for me it is very strange why it is allowed to overload unary <code>operator &amp;</code>, because it makes code more buggy and difficult to understand. Or there are some other reasons?</p>