Объект, созданный в main.cpp не виден в Chat.cpp
Вот мой недокод
1) Chat.h
#pragma once
#include <QtWidgets/QMainWindow>
#include "ui_chat.h"
#include <QTcpServer>
#include <QTcpSocket>
class Chat : public QMainWindow
{
	Q_OBJECT
public:
	Chat(QWidget *parent = Q_NULLPTR);
	void ShowMessage(QString Message);
private:
	Ui::ChatClass ui;
};
class MyServer : public QObject
{
	Q_OBJECT
public:
	explicit MyServer(QObject* parent = 0);
	QTcpServer* server;
signals:
public slots:
	void newConnection();
	void onRead(QString Mes);
};
2) Chat.cpp
#include <QDebug>
#include <QtGui>
#include <QLabel>
#include <QPlainTextEdit>
#include <QTextCodec>
#include "Chat.h"
Chat::Chat(QWidget *parent): 
	QMainWindow(parent)
{
	ui.setupUi(this);
	ui.label_3->setText("Errors logs");
}
MyServer::MyServer(QObject* parent) :
	QObject(parent)
{
	server =new QTcpServer(this);
	connect(server,SIGNAL(newConnection()), this, SLOT(newConnection()));              
	connect(server, SIGNAL(ReadyRead()), this, SLOT(onRead()));
	server->listen(QHostAddress::Any, 777);
}
void MyServer::newConnection() {
	QTcpSocket* socket = server->nextPendingConnection();
	socket->write("Kind of connected");
	socket->flush();
}
void MyServer::onRead(QString mes) {
	w.ShowMessage(mes);
}
void Chat::ShowMessage(QString Message) {
	ui.plainTextEdit->insertPlainText(Message);
}
3)Main.cpp
#include "Chat.h"
#include <QDebug>
#include <QtWidgets/QApplication>
#include <QtGui>
int main(int argc, char *argv[])
{
	QApplication a(argc, argv);
	MyServer mServer;
	Chat w;
	w.show();
	return a.exec();
}