title: A function that returns a queue?
body: <p>I'm trying to figure out how queues work in C++ and am getting stuck when dealing with objects. I seem to only be able to get a return address instead of the name of the object (which is what I really want). It's also showing an error when I try to pop the element from the queue. My code is as follows:</p>
  
  <p>Buyer.h file</p>
  
  <pre><code>#ifndef BUYER_H
  #define BUYER_H
  #include &lt;string&gt;
  #include &lt;queue&gt;
  #include "Order.h"
  #include "Entity.h"
  #include "Seller.h"
  
  class Order;
  
  class Seller;
  
  class Buyer : public Entity {
  
  public:
   Buyer(const std::string &amp;, const std::string &amp;, double);
   virtual ~Buyer() { }; // when step is added make this virtual
   void addSeller(Seller *);
   std::queue&lt;Seller*&gt; getSellers() const;
   void addOrder(Order *);
   std::queue&lt;Order*&gt; getOrders() const;
   virtual void list() const override;
   virtual void step() const override;
  
  private:
   std::queue&lt;Order*&gt; orders;
   std::queue&lt;Seller*&gt; sellers;
  
  };
  #endif
  </code></pre>
  
  <p>Buyer.cpp file</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;ostream&gt;
  #include &lt;stdexcept&gt;
  #include &lt;string&gt;
  #include &lt;queue&gt;
  #include "Buyer.h"
  #include "Seller.h"
  #include "Order.h"
  #include "Entity.h"
  using namespace std;
  
  Buyer::Buyer(const std::string &amp;name, const std::string &amp;id, double balance)
    : Entity(name, id, balance)
  {
    // initialize seller and order queue??
  } // Constructor
  
  void Buyer::addSeller(Seller *s) {
    sellers.push(s);
  } // addSeller
  
  std::queue&lt;Seller*&gt; Buyer::getSellers() const {
    while(!sellers.empty()) {
      return sellers;
    } // while
  } // getSellers
  
  void Buyer::addOrder(Order *o) {
    orders.push(o);
  } // addOrder
  
  std::queue&lt;Order*&gt; Buyer::getOrders() const {
    while(!orders.empty()) {
      return orders;
    } // while
  } // getOrders
  
  void Buyer::list() const {
    Entity::list();
    std::cout &lt;&lt; "Orders:\nOrder contains:";
    std::cout &lt;&lt; "\nSellers:\n";
    int i = 0;
    while(!sellers.empty()) {
      std::cout &lt;&lt; sellers.front() &lt;&lt; "\n";
      sellers.pop();
    } // while
  } //list
  
  void Buyer::step() const {
    std::cout &lt;&lt; "\nstep enter\n"
              &lt;&lt; "step exit\n\n";
  } // step
  </code></pre>
  
  <p>Any help is appreciated! Thank you!</p>