hi, im very new to c++, so any guidance is welcomed.
I'm wondering is it possible to use a variable ( which is a public member of a base class) from a class that is not derived from that base.

my understanding is that public members are accessible by all functions in a program but is this limited to derived classes from the base?

if so is it possible to get around this and what would be the best way.

I have seen the use of friend class which looks like it allows the friend class to access the private members of another class.
Is there something similar for public members.

i get the following type error when compiling the file by trying to use the variable in the following way from the non-derived class.
my_base_class::variable_name

Error : type `my base class' is not a base type for type 'class where I want to use variable_name'

when I just use the variable name directly, the file builds but the program fails with:
Error : undefined reference to `variable_name'

I'd appreciate any help.

thank you.