I am not sure if this is what you are asking but classes do not need to be global you can just use them wherever you need them. As for the member functions that you can access using the :: operator that is just there more or less for readablity. This is how I handle classes.
void setxValue(int value);
void setyValue(int value);
Imagine putting all of this into the above class it would get pretty ugly even with this basic class.
As for a class needing to be global the way you have to think about it is that is just a new datatype just like int, float,... they exist but unless you create one globally its only useable in the function you declare it in. say you might need a(for this case) fakeclass but only need it in fakeFunction not in main you just include fakeclass.h and then you can declare an instance of it.
std::cout<<"x value equals: "<< x <<std::endl;
std::cout<<"y value equals: "<< y <<std::endl;
void fake::setxValue(int value)
x = value;
void fake::setyValue(int value)
y = value;
Then ofcourse you could put all of this in on file but this is a simple class and even now it wouldn't be very "clean" looking. I hope this is what you were asking.
//declare an instance of fake called random
//that is local to fakeFunction
std::cout<<"random's x value: "<<random.getX()<<std::endl;
std::cout<<"random's y value: "<<random.getY()<<std::endl;
//main has no knowledge of random
//but you could still use a different instance of fake