Made toDense const.
Overloaded the << operator for printing (replaces the print function).