#include <iostream>
#include <memory>

std::shared_ptr<int> getData() {
    std::shared_ptr<int> a = std::make_shared<int>(5);
    return a;
}
int main() {
    std::shared_ptr<int> b = getData();
    auto c = b;
    std::cout << *b << std::endl;
    std::cout << *c << std::endl;
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: