title: C++ base vector refer to derived vector
body: <p>Why is this code not working?
  There are two vectors.
  The base vector elements should refer to the derived vector elements as a reference (not a copy).
  The output is random numbers, so, for some reason, the reference_wrapper elements doesn't refer correctly to the derived elements but.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  struct Base
  {
      Base (int a) : a_ (a) {}
      int a_;
  };
  
  struct DerivedA : Base
  {
      DerivedA (int a) : Base (a) {}
  };
  
  int main(int argc, const char * argv[]) {
      std::vector &lt;std::reference_wrapper &lt;Base&gt;&gt; b;
      std::vector &lt;DerivedA&gt; d;
  
      const int num = 100;
      for (int i = 0; i &lt; num; i++)
      {
          d.push_back (i);
          b.push_back (d.back());
      }
  
      for (int i = 0; i &lt; num; i++)
          std::cout &lt;&lt; b[i].get().a_;
  
      return 0;
  }
  </code></pre>