The class is simple, it has only a public member to serialize itself to disk and so I'd like to use the object like any other predefined integer variable.
Yes, but it's only the simplest class and in the program there are different classes more sofisticated and I'd like to know how to do it. I learnt a new thing.
Casting operators are quite risky. Casts in general are risky. (Whoever came up with const_cast...) But you can write a new operator overload where the first operand is an integer and the second is your class type. That should work fine for you.
no for private members u will have to return a copy of them. u cannot use directly.. this is special feature added in c++.. why u want to use them directly if yes.. make them public
This is not a special feature added in C++; it's an inherent concept of OO. (If you mean from C, you may be right, but C was a bit lacking compared to C++ in most respects.) The point is to encapsulate the class; to hide implementation from the user.