Context. Coronal mass ejections (CMEs) are large plasma structures expelled from the low corona to the interplanetary space with a wide range of speeds. In the interplanetary medium CMEs suffer changes in their speeds because of interaction with the ambient solar wind. Aims. To understand the interplanetary CME (ICME) dynamics, we analyze the interaction between these structures and the ambient solar wind (SW), approaching the problem from the hydrodynamic point of view. Methods. We assume that the dynamics of the system is dominated by two kinds of drag-force dependence on speed (U), as ∼U and ∼U 2 . Furthermore, we propose a model that takes variations of the ICME radius (R) and SW density (ρ sw ) into account as a function of the distance (x) as R(x) = x 0.78 and ρ sw (x) = 1/x 2 , respectively. Then, we solve the equation of motion and present exact solutions Results. Considering CME speeds measured at a few solar radii and at one AU, we were able to constrain the values of the constants (viscosity and drag coefficient) for the linear (U) and quadratic (U 2 ) speed dependences, which seems to reproduce the ICME -SW system well. We found different solutions in which the concavity of the curves of the ICME speed profile changes, depending on the dominant factor, either the ICME radius or the SW density. Conclusions. This work shows that the macroscopic ICME propagation may be described by the hydrodynamic theory and that it is possible to find analytical solutions for the ICME-SW interaction.