In my OpenFile function it should prompt user to enter a file name and read the file into an array. I keep getting the error: no match for 'operator>>' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'entryType'). I have done some research and found some similar questions related to this error. I didn't find the questions that helpful because they were poorly written. I think the problem could be using a void function or declaring the array as part of entryType. I know that I'm getting this error because the compiler looked for a function that could handle (istream) >> (entryType) but found none. How would I fix my code to get rid of this error?
Header File
include<string>
using namespace std;
enum Title {Mr, Mrs, Ms, Dr, NA};
struct NameType {
  Title title;
  string firstName;
  string lastName;
};
  struct AddressType {
  string street;
  string city;
  string state;
  string zip;
 };
struct PhoneType {
  int areaCode;
  int prefix;
  int number;
};
struct entryType {
  NameType name;
  AddressType address;
  PhoneType phone;
};
const int MAX_RECORDS = 50;
Code
entryType bookArray[MAX_RECORDS]; // entryType declared in header file
int main()
{
   entryType userRecord;
   string filename;
   ifstream inData;
   char searchOption;
   OpenFile(filename, inData);
   MainMenu(inData, filename);
   return 0;
}
void OpenFile(string& filename, ifstream& inData)
{
   do {
       cout << "Enter file name to open: ";
       cin >> filename;
       inData.open(filename.c_str());
       if (!inData)
           cout << "File not found!" << endl;
   } while (!inData);
   if(inData.is_open())
   {
       for(int i=0; i<MAX_RECORDS;i++)
       {
           inData >> bookArray[i];
       }
   }
}
 
    