Diffusion and friction from force correlations