Two positive integers $a$ and $b$ are such that $a+b=\frac{a}{b} +\frac{b}{a}$ . What is the value of $a^2 + b^2$?

Two positive integers $a$ and $b$ are such that $a+b=\frac{a}{b} +\frac{b}{a}$ . What is the value of $a^2 + b^2$?

Got this in a sample question paper for a contest but i have no idea how to solve it. I tried to apply inequalities but it did it not work. Please help

Hints: $$\frac{a}{b} \le a$$ $$\frac{b}{a} \le b$$ If either inequality is strict, you get an immediate contradiction.
Alternatively: Without loss of generality, assume $1\le a\le b$. Then: $$a+b=\frac{a}{b}+\frac{b}{a}\le \frac{b}{b}+\frac{b}{1}=1+b\Rightarrow a\le 1 \Rightarrow a=1.$$