A model for continuous-opinion dynamics is proposed and studied by taking advantage of its similarities with a mono-dimensional granular gas. Agents interact as in the Deffuant model, with a parameter $alpha$ controlling the persuasibility of the individuals. The interaction coincides with the collision rule of two grains moving on a line, provided opinions and velocities are identified, with $alpha$ being the so-called coefficient of normal restitution. Starting from the master equation of the probability density of all opinions, general conditions are given for the system to reach consensus. The case when the interaction frequency is proportional to the $beta$-power of the relative opinions is studied in more detail. It is shown that the mean-field approximation to the master equation leads to the Boltzmann kinetic equation for the opinion distribution. In this case, the system always approaches consensus, which can be seen as the approach to zero of the opinion temperature, a measure of the width of the opinion distribution. Moreover, the long-time behaviour of the system is characterized by a scaling solution to the Boltzmann equation in which all time dependence occurs through the temperature. The case $beta=0$ is related to the Deffuant model and is analytically soluble. The scaling distribution is unimodal and independent of $alpha$. For $beta>0$ the distribution of opinions is unimodal below a critical value of $|alpha|$, being multimodal with two maxima above it. This means that agents may approach consensus while being polarized. Near the critical points and for $|alpha|ge 0.4$, the distribution of opinions is well approximated by the sum of two Gaussian distributions. Monte Carlo simulations are in agreement with the theoretical results.