We can show by a counter example that such a function cannot exist. Lets do proof by contradiction, let say there exists a continuous function which has this property, lets say it graph is $ y = f(x) $ which has a domain over all reals as you have given. Now, lets draw the graph $y = px$ (p being rational, chosen such that this could cross f(x)), now as the function assumed $f(x)$ is continuous this would definitely intersect somewhere with $y = f(x)$ for some p, lets say this point is $x = k$, now as the line is $y = px$ this implies $f(k) = pk$ but this is a contradiction as we know when $pk$ is rational $f(k)$ has to be irrational and vice-versa, and rational and irrational can never be equal so such a function $f(x)$ cannot exist.
Additionally, we can extend this by drawing $y = mx$ instead of $y = x$ and with m being rational and noting that rational multiplied with rational is rational and irrational multiplied with rational irrational, that, we cannot even have a piece-wise continuous function with such property, as we can set m such that we can cross each piece-wise continuous part and show continuity cannot exist as x and y co-ordinates both have to be rational at once or irrational at once same as the initial argument proposed!