Models of trait evolution form an important part of macroevolutionary biology. The Brownian motion model and Ornstein-Uhlenbeck models have become classic (null) models of character evolution, in which species evolve independently. Recently, models incorporating species interactions have been developed, particularly involving competition where abiotic factors pull species toward an optimal trait value and competitive interactions drive the trait values apart. However, these models assume a fitness function rather than derive it from population dynamics and they do not consider dynamics of the trait variance. Here we develop a general coherent trait evolution framework where the fitness function is based on a model of population dynamics, and therefore it can, in principle, accommodate any type of species interaction. We illustrate our framework with a model of abundance-dependent competitive interactions against a macroevolutionary background encoded in a phylogenetic tree. We develop an inference tool based on Approximate Bayesian Computation and test it on simulated data (of traits at the tips). We find that inference performs well when the diversity predicted by the parameters equals the number of species in the phylogeny. We then fit the model to empirical data of baleen whale body lengths, using three different summary statistics, and compare it to a model without population dynamics and a model where competition depends on the total metabolic rate of the competitors. We show that the unweighted model performs best for the least informative summary statistic, while the model with competition weighted by the total metabolic rate fits the data slightly better than the other two models for the two more informative summary statistics. Regardless of the summary statistic used, the three models substantially differ in their predictions of the abundance distribution. Therefore, data on abundance distributions will allow us to better distinguish the models from one another, and infer the nature of species interactions. Thus our framework provides a conceptual approach to reveal species interactions underlying trait evolution and identifies the data needed to do so in practice.