class Device;
class VFS {
public:
class {
friend Device;
void operator()(int y) {/* do stuff with y here*/}} register_device;
};
class Device {
public:
void foo(VFS fs) {
fs.register_device(1);
}
};
int main(int argc, char *argv[]) {
// fails:
// VFS().register_device(2);
// works:
Device().foo(VFS());
return 0;
}
and no need for a badge class (erm... well but an anon class).
On the other hand, if your bookkeeping application uses a database try to keep things as tidy as possible.