Structural induction and coinduction in a fibrational setting