A method of analysis is presented for estimating the magnitude of a treatment effect among compliers in a clinical trial which is asymptotically unbiased and respects the randomization. The approach is valid even when compliers have a different baseline risk than non-compliers. Adjustments for contamination (use of the treatment by individuals in the control arm) are also developed. When the baseline failure rates in non-compliers and contaminators are the same as those who accept their allocated treatment, the method produces larger treatment effects than an 'intent-to-treat' analysis, but the confidence limits are also wider, and (even without this assumption) asymptotically the efficiencies are the same. In addition to providing a better estimate of the true effect of a treatment in compliers, the method also provides a more realistic confidence interval, which can be especially important for trials aimed at showing the equivalence of two treatments. In this case the intent-to-treat analysis can give unrealistically narrow confidence intervals if substantial numbers of patients elect to have the treatment they were not randomized to receive.