Quoting strings passed to an output stream This class allows me to quote strings being sent to an output stream:

class Quote{
public:
    friend std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, const Quote&amp; obj){
        obj.write(os);
      return os;
    }
    Quote() = delete;
    Quote(const string &amp; text): text(text){}

    void write(ostream &amp; os) const{
        os &lt;&lt; default_quote_token &lt;&lt; text &lt;&lt; default_quote_token;
    }
private:
    const string &amp; text;
};


Like this:

os &lt;&lt; Quote(name);


It feels like a lot of work to avoid:

os &lt;&lt; "\"" &lt;&lt; name &lt;&lt; "\"";


Is there a better solution?
In C++14, there's std::quoted. Some advantages it has over your approach:


It works with both output and input streams
You can specify the delimiter and escape character
It's a stream manipulator, allowing it to be used seamlessly with operations while yours is a one-off class with zero interoperability
It supports wide strings