Access variable from class

Hi everyone. I've been looking for this answer but I couldn't find it.

In the main file of the sketch (MAIN.INO), I have this:

bool SDIni = false;

void setup()
{
  pinMode(53, OUTPUT);
  SDIni = SD.begin(53);
  if (!SDIni) { Serial.println("SD can't be initialized"); }
  else {
    gps_log = SD.open(gps_file, FILE_WRITE); // It's declared in file SIM5320E.h
  }
}

void loop()
{
...
}

In another separate class file (SIM5320E.CPP) I want to access SDIni variable but I can't. I've got the error:

SIM5320E.cpp:215:3: error: 'SDIni' was not declared in this scope.

SDIni is a global variable, ¿why can't I access to it?

I assure u I've read all about variables and arduino, and I can't find an appropriate answer.

Any help, please.

Because globals have file scope, it is not visible in other source files. In regular C you would put an "extern bool SDIni;" declaration in the other cpp file.

Or create a "method" in the main file that returns the value of SDIni.

Perfect. That's exactly what I need to understand.

Thanks a lot.