Overload operator<< to print Dim1 and Dim2.