Is it possible to declare a variable in a class, so that the variable is read/write to all class members, but read-only to functions which are not part of the class?

Eg.

Code:
class myClass
{
   int i;
// blah blah
}

void myClass::myFunc (void)
{
   i = 2; // ok, it's writable.
}

void Otherclass::Otherfunc (void)
{
   myClass Obj;
   
   Obj.i = 2; // error, variable read-only
}