How to print the address of an Object in C++

#include <iostream>

class MyClass {
public:
    int data;
};

int main() {
    MyClass obj;

    std::cout << "Address of the object: " << &obj << std::endl;

    return 0;
}