title: Can I initialise an object of a derived class in another derived class?
body: <p>Can I initialise an object of a derived class in another derived class (where both classes are derived from the same base class) in C++? I want to do this as I want to overload the &gt;&gt; operator to enable me to populate derived_class_a's base class pointer vector with objects of derived_class_b.</p>
  <p>Thanks</p>
  <p>E.g.</p>
  <pre><code>class base_class
  {
  }
  
  class derived_class_a : base_class
  {
  }
  
  class derived_class_b : base_class
  {
  derived_class_a variable{};
  }
  </code></pre>