title: C++ Accessing private vector values
body: <p>I'm doing a restaurant management program. Right now I'm trying to output private vector data and am getting stuck.</p>
  
  <p>So I have a Menu.h</p>
  
  <pre><code>private:
  vector&lt;Category&gt; categories;
  vector&lt;Menu_Item&gt; menu_items;
  vector&lt;Recipe&gt; recipes;
  vector&lt;Ingredient&gt; ingredients;
  vector&lt;Order&gt; orders;
  vector&lt;Order_Item&gt; order_items;
  </code></pre>
  
  <p>And Menu.cpp</p>
  
  <pre><code>Menu.read()
  Menu.show()
  </code></pre>
  
  <p>The read function reads from a file like this</p>
  
  <pre><code>1010    Appetizers                                      
  1901    Entrees                                     
  1576    Desserts                                        
  1320    Drinks  
  </code></pre>
  
  <p>And stores those values into the appropriate vector, for example this one would be vector categories.</p>
  
  <p>I also have a .h file for all the different types of things like, Menu_Item.h, Recipe.h, etc. And I store values into the vector like such:</p>
  
  <pre><code>menu_items.push_back(Menu_Item(meniID, catID, rID....
  </code></pre>
  
  <p>However in Menu_Item.h the values are</p>
  
  <pre><code>private:
  int menu_item_id;
  int cat_id;
  int recipe_id;
  string menu_item_name;
  double price;   
  </code></pre>
  
  <p>The show() function queries the user what he/she wants to see. Let's say the user wants to see a specific menu item like Onion rings. What I can't do is </p>
  
  <pre><code>if(menu_items[0].menu_item_name == "Onion Rings")
  </code></pre>
  
  <p>because it says that menu_item_name value is private within Menu_Item.h. How can I access the private data?</p>