You can accomplish what you need using a proxy:
class A { double a; class proxy { A &a; public: proxy(A &a) : a(a) {} operator double() const { return a; } proxy operator=(double d) { aa = d; return *this; } }; public: proxy Value() { return proxy(*this); } }
This requires (internal) changes for your class A , but not for code that uses it. However, it will split the code for reading and writing to the item data, so you can set breakpoints individually.
source share