Passing variables from one class to another (Newbie from Processing)

Hello, my apologies - I know this has been asked before but I still just don’t understand. I am coming straight over from Processing and am brand new to OF. In Processing, I have a whole class dedicated to sending and receiving OSC. From there, other classes listen to those variables. However, I am realizing it is not as simple in OF, as class1 does not know class2 exists?

For my understanding, what would be the best way to make the below code work. Passing x from class 1 to class 2.

class1.h

#ifndef class1_h
#define class1_h
#include "ofxiOS.h"

class style{
public:
    void setup();
    float x;
};

#endif

class1.mm

#include "ofApp.h"
#include "class1.h"

void class1::setup(){
   x = 10;
}

class2.h

#ifndef class2_h
#define class2_h
#include "ofxiOS.h"

class class2 {
public:
    void setup();
};

#endif

class2.mm

#include "ofApp.h"
#include "class2.h"

void class2::setup(){
    ofLog() << x;
}

Thank you all in advance.

Hi
As you’ve write your question, the solution seem to implement class2 as derived from class1.
Here’s a detailed explanation: https://en.cppreference.com/w/cpp/language/derived_class

HTH