The relation between the frequency-dependent friction of a molecule in a liquid and the hydrodynamic properties of the liquid is fundamental for molecular dynamics. We investigate this connection for a water molecule moving in liquid water using all-atomistic molecular dynamics (MD) simulations and linear hydrodynamic theory. We analytically calculate the frequency-dependent friction of a sphere with finite surface slip moving in a viscoelastic compressible fluid by solving the linear transient Stokes equation, including frequency-dependent shear and volume viscosities, both determined from MD simulations of bulk liquid water. From MD simulation trajectories, we also determine the frequency-dependent friction of a single water molecule moving in liquid water, as defined by the generalized Langevin equation. The frequency dependence of the shear viscosity of liquid water requires careful consideration of hydrodynamic finite-size effects to observe the asymptotic hydrodynamic power-law tail. By fitting the effective sphere radius and the slip length, the frequency-dependent friction and velocity autocorrelation function from the transient Stokes equation and simulations quantitatively agree. This shows that the transient Stokes equation accurately describes the important features of the frequency-dependent friction of a single water molecule in liquid water and thus applies down to molecular length and time scales, provided accurate frequency-dependent viscosities are used. In contrast, for a methane molecule moving in water, the frequency-dependent friction cannot be predicted based on a homogeneous model, which, supported by the extraction of the frequency-dependent surface slip, suggests that a methane molecule is surrounded by a finite-thickness hydration layer with viscoelastic properties that differ significantly from those of bulk water.