I am working on a car rental program, and in it I need to be able to access a vector of the cars and prices from another class in order to make the receipt. Except every time I try to access the vector, there is nothing in it. How can I access the vector with the data in it?
#include <iostream>
#include <vector>
#include <string>
#include <fstream>
using namespace std;
const string SPORTS_CARS = "sports.dat";
class InventoryItem
{
public: 
  InventoryItem() {};
  ~InventoryItem() {};
  friend class Cart;
  vector<string> listOfCars;
  vector<float> listOfPrices;
  void readSports()
  {
    string car;
    float price;
    ifstream input(SPORTS_CARS);
    if (input.is_open())
    {
      while (!input.eof())
      {
        getline(input, car);
        input >> price;
        input.ignore();
        listOfCars.push_back(car);
        listOfPrices.push_back(price);
      }
    input.close();
  }
  }
};
class Cart
{
public:
  Cart() {};
  ~Cart() {};
  void select()
  {
    InventoryItem a;
    for (int i = 0; i < a.listOfCars.size(); i++)
    {
      cout << a.listOfCars[i] << endl;
    }
  }
};
int main() {
  InventoryItem item;
  item.readSports();
  Cart cart;
  cart.select();
}
 
    