title: Why do I need to dereference iterator to smart pointer twice instead of using operator->()?
body: <p>Suppose I have a following code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;deque&gt;
  #include &lt;memory&gt;
  
  struct Test
  {
      int test;
  };
  
  int main(int, char**)
  {
      std::deque&lt;std::unique_ptr&lt;Test&gt;&gt; deque;
      deque.push_back(std::unique_ptr&lt;Test&gt;(new Test{10}));
      auto start = deque.begin();
      std::cout &lt;&lt; start-&gt;test &lt;&lt; std::endl;               // &lt;- compilation error
      std::cout &lt;&lt; (start.operator-&gt;())-&gt;operator-&gt;()-&gt;test &lt;&lt; std::endl; // &lt;- OK
  }
  </code></pre>
  
  <p>Why is smart-pointer treated as if it would be regular pointer object, although it is not (as far, as I understand)? From what I know, <code>operator-&gt;()</code> should recur until it reaches <code>T*</code>.</p>
  
  <p>Here are some related questions <a href="https://stackoverflow.com/questions/10677804/how-arrow-operator-overloading-works-internally-in-c">on how arrow overloading works</a> and <a href="https://stackoverflow.com/questions/11960631/c-iterating-through-a-vector-of-smart-pointers/">that we need to dereference twice instead of an arrow</a>.</p>