If I’m understanding correctly what you want, then this should do the trick for blueprints.
UPROPERTY(BlueprintReadOnly)
type name;
For other C++ classes, you would need to make a getter function, as you regularly might.
I would recommend against making any variables private to the C++ codebase, but if you really prefer that style don’t forget to inline it
In C++ you can declare a private UPROPERTY but you’ll get a compiler error or warning if you try to make it BlueprintReadOnly or BlueprintReadWrite. To get around this, you can specify explicitly that you allow a blueprint accessible variable to be private using this:
So that makes a private variable accessible in blueprint. (My preference though is to declare the UPROPERTIES protected, since making a private variable read accessible already doesn’t make it private.) To give access to it from other C++ classes, simply make public getter/setter functions.