#include <iostream>
#include <string>

struct bar
{
    bar(const std::string& str) : _str(str) {}
    
    bar(const bar&) = delete;

    bar(bar&& other) : _str(std::move(other._str)) {other._str = "Stolen";}

    void print() {std::cout << _str << std::endl;}

    std::string _str;
};

struct foo
{
   foo(bar& b) : _b(b) {}
   
   ~foo() {_b.print();}

   bar& _b;
};

bar foobar()
{
    bar b("Hello, World!");
    foo f(b);

    return std::move(b);
}

int main()
{
    foobar();

    return EXIT_SUCCESS;
}