This is just an abstract example of what Iam trying to do, but in my code I get the following error as soon as myclassB::DoSomething(..) has the argument as described above.
no matching function for call to 'myclassB::DoSomething(myclassA (&)())'
What the hell I am doing wrong?
What is the compiler trying to tell me with the "(&)()" in the error message?
If the constructor takes no arguments you CAN'T use the empty parentheses: (). If there is a type declaration in the parens the compiler knows you are declaring a function with an argument. If there is a value in the parens the compiler knows you are calling a function. When there is nothing in the parens the compiler can't tell for sure so it defaults to declaring a function, but you want to call the constructor, not declare it. You have to leave the parens out.
But just to understand this. I am telling the compiler that I want to create an object of the type myClassA, so he should know that I declared a constructor for it, shouldn't he?
Yes it does, but what if you wanted to declare a function that returns an object of type myclassA?
Perhaps you can mark the most helpful post as the solution then? This prevents helpers spending time on a solved issue and it will lead people with the same question to the correct answer directly.