Reference solution
One correct implementation. Alternative approaches that satisfy the constraints are equally valid — the reviewer judges behaviour, not style.
#include <iostream>
using namespace std;
class Counter {
private:
int value = 0;
public:
void set(int v) { value = v; }
int get() const { return value; }
};
int main() {
Counter c;
c.set(5);
cout << c.get() << '\n';
return 0;
}