Variables defined inside of a method are "local variables" -- their names are not visible outside of the method in which they're defined. The variable "class1" is local to the method "main" in Class2, and therefore is available nowhere else.
Well, looking at your code and trying to guess what you want to accomplish: you want to call someFunction() and have it operate on a specific instance of Class1, created by Class2. The best way to do this, instead of using member variables like (yuk) global variables, is to give someFunction() an argument -- i.e., define someFunction like
Then you can create a Class1 in Class2.main() and pass it to Class3.someFunction(), like this:
Although this may look like a small change, it's really rather profound. What we've done is to decouple Class3 and Class2. Class3 doesn't need to know anything about Class2, and this makes it easier to write the classes and to maintain them when they need to change. The main reason is that it makes everything easier to understand: you can see what someFunction() does without knowing anything about any other class that might use it.