#include <memory>
#include <iostream>
class SomeObj
{
public:
    SomeObj() {}
    SomeObj(const int& val)  : val_(std::make_shared<int>(val))
    {
        std::cout << *val_;
    }
    void set(const int& val)
    {
        val_ = std::make_shared<int>(val);
    }
    friend bool operator&&(const SomeObj&, const SomeObj&);
private:
    std::shared_ptr<int> val_;
};
bool operator&&(const SomeObj& lhs, const SomeObj& rhs)
 {
     return lhs.val_ && rhs.val_;
 }
int main() {
    if (SomeObj(1) && SomeObj(2)) {
        std::cout << 3;
    }
    return 0;
}
Login in to like
Login in to comment