I'm currently learning c++ and i'm struggling with an example that our tutor provided. He's creating a new Object ("Strudel") and immediately outputs it.
cout<<Strudel{"Nuss"};
this creates a runtime error.
operator<<(basic_ostream<_CharT, _Traits>& __os,
    ^
/usr/...../include/c++/9/ostream:548:5: note: candidate template ignored: could not match 'const _CharT *' against 'Strudel'
    operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
I'm also not sure if this even works. I haven't found a single tutorial that does it like that beside what we saw in class.
#include<iostream>
using namespace std;
    class Strudel{
        public:
            string Inhalt;
        Strudel(string x):Inhalt{x}{
            if(Inhalt.size()==0){
                throw runtime_error("kein Name!");
            }
        }
    ostream& print(ostream & os){
        return os<<this->Inhalt<<"-Strudel";
    }           
    };
    ostream & operator<<(ostream &os, Strudel &s){
        return s.print(os);
    }
int main(){
    Strudel x{"Mohn"};
    cout<<x<<endl;
    cout<<Strudel{"Nuss"};
    return 0;
}
 
    