Castigliano's Theorem for Deflections