Okay so I've been reading a bit on Thermodynamics and I found something that I couldn't wrap around my head. For an ideal gas, the change in internal energy is equal to
$$\Delta U = Q + W$$
And also, if the internal energy is a function of volume and temperature, we can write
$$\mathrm{d}U = \left( \frac{\partial U}{\partial V} \right)_T \mathrm{d}V + \left( \frac{\partial U}{\partial T} \right)_V \mathrm{d}T$$
Which is the same as
$$\mathrm{d}U = \pi_T \mathrm{d}V+C_V \mathrm{d}T$$
Now the book I'm reading, Atkins' Physical Chemistry, argues that $\pi_T$ is equal to zero for ideal gases. The book reasoned by using the expression $U = \frac{NfkT}{2}$, where $f$ is the number of degrees of freedom. My question is, if the internal energy of an ideal gas is independent of its volume, then how it is possible then that doing work to the system changes its internal energy? As $$W=-\int_{V_i}^{V_f}P(V)\mathrm{d}V$$ Clearly there is a change in volume (e.g. from pushing a piston). Furthermore, the expression $U = \frac{NfkT}{2}$ can easily be converted into $U = \frac{fPV}{2}$ by invoking the ideal gas law.
Since it is claimed that the internal energy of an ideal gas is independent of its volume, the above reasoning that I came in conclusion doesn't seem to support it. I know there must be something wrong with my reasoning, but I can't figure it out. What am I doing wrong here?