No, it is not possible for $f$ to be continuous.
Suppose that there was a continuous $f$. Then $f(\mathbb{Q})$ has countable image, since $\mathbb{Q}$ is countable. And $f(\mathbb{R}\backslash \mathbb{Q})$ has countable image, since its image is a subset of the rationals. And so $f(\mathbb{R})$ is countable.
On the other hand, since $\mathbb{R}$ is connected and $f$ is continuous, then $f(\mathbb{R})$ is connected. But the only connected countable sets are singletons, $\{x\}$, which is clearly a contradiction. $\diamondsuit$
As an alternate end, which doesn't use connectedness (directly, that is) but instead uses the Intermediate Value Theorem:
Call $f(0) = a$, which is some irrational, and $f(\pi) = b$, which is some rational. Since $f$ is continuous, the image of $f$ must contain every number in the interval $[a,b]$. However there are uncountably many points on$[a,b]$, while the image of $f$ has only countably many points. We have a contradiction. $\diamondsuit$