Double counting because of gross mixed income I was learning the income method of calculating GDP when I stumbled upon this doubt.

As per the definition given in the book

GDP = GDI (Gross Domestic Income) = Compensation of employees + Gross Operating Surplus + Gross Mixed Income + Taxes less subsidies on production + Taxes less subsidies on products and imports.

My doubt here is as follows:

Gross mixed income encompasses incomes of incorporated businesses (for instance sole proprietorship). However, if we consider one scenario that Mr. X is an employee of XYZ corporation. He gets his compensation as $ \$100.$ He pays $\$50$ for his fever treatment to Dr. Y. Now, as per the above definition, Dr. Y's $ \$50 $ will be added with Mr. X's $ \$100$ leading to double counting of the country's income.

How do we deal with such situations? Any help will be appreciated.
According to the scenario Mr. X is an employee of XYZ and not the owner of the business (sole proprietorship).  So his $50 dollars won’t get count towards his own earnings.  It should get counted toward Gross Operating Surplus. 

If he was the owner of the business then it still wouldn’t be counted under compensation of employee for Mr. X because at that point he would not be an employee.  It would be counted toward Dr. Y's earnings.