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.

• Is that a problem? Dr Y produced \$50 worth of fever treatments and Mr X produced \$100 worth of whatever he produces. – user253751 Jan 28 at 11:03