Operator Overloading C++; too many parameters for << operation

You are overloading << operator as a member function, therefore, the first parameter is implicitly the calling object. You should either overload it as friend function or as a free function. For example: overloading as friend function. However, the canonical way is to overload it as free function. You can find very good information from this post: C++ operator overloading

Javascript: operator overloading

As you’ve found, JavaScript doesn’t support operator overloading. The closest you can come is to implement toString (which will get called when the instance needs to be coerced to being a string) and valueOf (which will get called to coerce it to a number, for instance when using + for addition, or in many cases … Read more

assignment operator overloading in c++

There are no problems with the second version of the assignment operator. In fact, that is the standard way for an assignment operator. Edit: Note that I am referring to the return type of the assignment operator, not to the implementation itself. As has been pointed out in comments, the implementation itself is another issue. … Read more