Problem returning a reference to a file with a get method

Hi guys, I have a class whose one of it's methods has the purpose of return a reference to a private ifstream member. This one:

1
2
3
ifstream& FileManager::getFileReader () {
  return &fileReader;
}


Unfortunatelly it's generating this error message
FileManager.cpp:12: error: invalid initialization of non-const reference of
type 'std::ifstream&' from a temporary of type 'std::ifstream*'


Can anyone explain it to me? Thanks.
Don't return the address of fileReader. Just return fileReader itself.
&fileReader returns a pointer to that type.
Topic archived. No new replies allowed.