Inequalities of Hermite-Hadamard type for functions of selfadjoint operators and matrices