add CounterThread as a friend class of MainWindow